<HTML><HEAD><TITLE>put(+Stream, +Ascii)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Character I/O</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>put(+Stream, +Ascii)</H1>
The character represented by the ascii integer code Ascii is put onto the
buffered output stream Stream.


<DL>
<DT><EM>Stream</EM></DT>
<DD>Integer (stream number) or Atom (reserved or user-defined                symbolic stream name).
</DD>
<DT><EM>Ascii</EM></DT>
<DD>Integer.
</DD>
</DL>
<H2>Description</H2>
   Puts the character represented by the integer ASCII code Ascii (in the
   range 0 to 255) onto the buffered output stream Stream.

<P>
   The output from put/2 is buffered first, and is only output to the
   stream when the output is flushed (e.g.  using flush/1).

<P>
   ASCII codes for the non-printable characters (i.e.  control characters)
   are also acceptable.

<P>

<H3>Modes and Determinism</H3><UL>
<LI>put(+, +) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Stream is not instantiated.
<DT><EM>(4) instantiation fault </EM>
<DD>Ascii is not instantiated.
<DT><EM>(5) type error </EM>
<DD>Stream is neither an integer nor an atom.
<DT><EM>(5) type error </EM>
<DD>Ascii is instantiated, but not to an integer.
<DT><EM>(192) illegal stream mode </EM>
<DD>Stream is not an output stream.
<DT><EM>(193) illegal stream specification </EM>
<DD>Stream is an illegal stream specification.
</DL>
<H2>Examples</H2>
<PRE>
Success:
      [eclipse]: put(output, 0'a).
      a
      yes.

      [eclipse]: sh('cat file1').
      a
      yes.
      [eclipse]: open(file1,read,s1),
      &gt;        open(file2,write,s2),repeat,
      &gt; (at_eof(s1)-&gt;!,
      &gt;             flush(s2),
      &gt;             close(s1),close(s2)
      &gt;            ;
      &gt;             get(s1,Char),
      &gt;             put(s2,Char),
      &gt;             fail).
      Char = _g72
      yes.
      [eclipse]: sh('cat file2').
      a
      yes.

Error:
      put(output,A).             (Error 4).
      put(Stream,98).            (Error 4).
      put(output, '98').         (Error 5).
      put(output, 98.0).         (Error 5).
      put("string" A).           (Error 5).
      put(11,97).                (Error 192). % stream not open
      put(atom,97).              (Error 193).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/iochar/get-1.html">get / 1</A>, <A HREF="../../kernel/iochar/get-2.html">get / 2</A>, <A HREF="../../kernel/iochar/put-1.html">put / 1</A>, <A HREF="../../kernel/iochar/nl-1.html">nl / 1</A>
</BODY></HTML>
